Writing QuickEditor Plug-in Modules by Mathias Tschopp, april 1995. QuickEditor 3.5 accepts 2 different kind of plug-ins: Transitions and Filters (also referred to as Video Effects). At startup the application scans the plug-ins folder for files of type 'QEdT' (Transition) and 'QEdF' (Filter). When it finds a file of the right type it checks for a 'QEdR' resource, ID 128, if the programs runs on a 68k machine, ID 129 if the program runs on a PowerPC. If the correct resource is there, the name of the plug-in is added to the Transition or Filter menu. The 'QEdR' resource ID 128 is a 68k Code Resource. The 'QEdR' resource ID 129 is a PowerPC Code Resource, with a native header. QuickEditor running native on a PowerMac doesn't recognize 68k plug-ins (Those having only a 'QEdR' ID 128 resource). A 'Fat' plug-in is one that has both 'QEdR' ID128 and 'QEdR' ID129 resources, and can be used with QuickEditor on both Mac and PowerMac machines. PowerPC-only plug-ins won't appear on the menu of the application running on a 68k Macintosh, even if they are indeed present in the folder. As a consequence, different Mac models could share a common Plug-in folder over a network. QuickEditor plug-ins can be sold or given away freely, according to their creator's whishes. Mathias Tschopp retains no copyright on QuickEditor's Plug-in Technology, but would appreciate receiving a copy of every new plug-in created for QuickEditor (although this is not mandatory). 1. Writing Transition Plug-ins Transition plug-ins are files of type 'QEdT' and creator '.ƒ∂!', resource type 'QEdR'. The plug-in code must be a stand-alone code module. When called, the current resource fork will be the plug-in's, and the code module is free to load in whatever resources it needs (pictures for instance...). Your Transition module must also have a STR# Resource ID 128 that contains the names of the different subtypes of your Transition. Wipe - from the Left (In this expample, 'from the Left ' and ' from the - from the Right right ' are 2 subtypes of the Transition Wipe). A Transition is passed the following parameters: -the current frame number. -a pointer to a 32-bit deep GWorld containing a frame extracted from the Movie. -a pointer to a 32-bit deep GWorld containing a frame extracted from the Clip. -the total duration of the effect (in frames). -a number indicating which subtype of the Transition has been selected. -the bounding rectangle of the movie. Those are used to calculate what the current frame should look like. The processed frame should be stored into the GWorld that contained the image extracted from the Clip. QuickEditor handles all of the overhead for retrieving the right frames and storing them. Here's what your Transition function should look like. Boolean Transition (whichFrame, movieGWorld, clipGWorld, numberOfFrames, version, movieBounds ); short whichFrame ; Current frame number. 0=the first frame of the Transition 1= the second, and so on. GWorldPtr movieGWorld ; Pointer to the GWorld containing the current frame from the Movie. GWorldPtr clipGWorld ; Pointer to the GWorld containing the current frame from the Clip. short numberOfFrames ; Total number of frames the Transition will be made of. while whichFrame < numberOfFrames the Transition is not complete. short version ; Indicates which subtype of Transition has been chosen. version=0, the first subtype has been chosen. version=1, the second subtype... Rect *movieBounds ; The bounding rectangle of the movie (and the two GWorlds). The function's return value should be: 0 (No Error) and 1 (Error). A returned value of 1 will abort the Transition. Let's say the user chose a Transition with a duration of 30 frames, your function will be called 30 times with the following arguments: - Transition (0, movieGWorld, clipGWorld, 30, movieBounds ); - Transition (1, movieGWorld, clipGWorld, 30, movieBounds ); - Transition (2, movieGWorld, clipGWorld, 30, movieBounds ); (...) - Transition (29, movieGWorld, clipGWorld, 30, movieBounds ); Transition plug-ins intended to run on a 68k Macintosh must be compiled as Code Resources of type 'QEdT', creator '.ƒ∂!', ResType 'QEdR', ResID 128. PowerPC plug-ins must be compiled as a Code Resource of type 'QEdT', creator '.ƒ∂!', ResType 'QEdR', ResID 129 with a 'native' header. A Fat plug-in is created by pasting the QEdR resource ID 129 into the 68k plug-in with ResEdit or Resorcerer. 2. Writing Video Effect Plug-ins Video Effects (Filters) plug-ins are files of type 'QEdF' and creator '.ƒ∂!', resource type 'QEdR'. The plug-in code must be a stand-alone code module. When called, the current resource fork will be the plug-in's, and the code module is free to load in whatever resources it needs. If the code module needs to store variables, it can modify its own resource fork for later retrieval of parameters. A Video Effect is passed the following parameters: -the current frame number. -a pointer to a 32-bit deep GWorld containing a frame extracted from the Clip. (If a Clip is to be involved in the effect, as in a Incrustation. Otherwise the GWorld contains a blank image) -a pointer to a 32-bit deep GWorld containing a frame extracted from the Movie. -the total duration of the effect (in frames). -the bounding rectangle of the movie. -a message specifying what the Effect is expected to do. Once your routine has processed the image, it should store it back into the second GWorld, the one that contained the original image from the Movie. Here's what your Video Effect function should look like. Boolean Filter (whichFrame, GWorld1, GWorld2, numberOfFrames, movieBounds, message ); short whichFrame ; Current frame number. Only useful for dynamic Filters. GWorldPtr GWorld1 ; Pointer to a GWorld containing the current frame from the Clip (if applicable). GWorldPtr GWorld2 ; Pointer to a GWorld containing the current frame from the Movie. short numberOfFrames ; Total number of frames the Effect will be made of. Only useful for dynamic Filters. When whichFrame < numberOfFrames the Transition is not complete. Rect *movieBounds ; The bounding rectangle of the movie and both the GWorlds. messageType *message ; Message telling your function what it has been called for. The function's return value should be: 0 (No Error) and 1 (Error). A returned value of 1 will abort the processing of the Effect. The Messages The message variable contains information QuickEditor sends your plug-in telling it what it has been called for. The message variable type is: typedef struct { short what; Point where; } messageType ; 1. message.what=-1 (Init Message) QuickEditor sends a message with the what field set to -1 when the user chooses your effect in the Select Menu. At that time your should set your Effect's controls to their default values. 2. message.what=0 (Update Message) QuickEditor sends a message with the what field set to 0 when it receives an Update Event. When it receives such a message, your function must redraw the parts of the Video Effects Panel it is responsible for. That includes the Filter Screen and the different controls (if any) your Filter uses. Unlike in the -1 message the controls must be restored to the state they were before the Update Event, not their default value. When QuickEditor calls your function with an Update Message, the graphic port is set to QuickEditor's Window. 3. message.what=1 (Process Message) QuickEditor sends a message with the what field set to 1 when it is processing an effect. At this time your function only has take the image present in GWorld2, process it and put it back in this same GWorld. When QuickEditor calls your function with an Process Message, the graphic port is set to the second GWorld (GWorld2). 4. message.what=2 (MouseDown Message) QuickEditor sends a message with the what field set to 2 when a MouseDown Event occurs in the Filter Screen . Your Effect routine is responsible for handling the different controls it provides and giving visual feedback to the user. The 'where' field of the 'message' variable contains the coordinate of the point the User clicked on. When QuickEditor calls your function with an MouseDown Message, the graphic port is set to QuickEditor's Window.   This figure shows which zones of the Video Effect panel your Video Effect plug-in is responsible for. Every time the user clicks on one of the red zones, QuickEditor sends your plug-in a MouseDown message. It is up to your function to respond to this click ( or ignore it if the user didn't click on any control ). Do not draw outside the bright red zone, since QuickEditor only erases those zones when the user selects another Effect. The dimmed red zone should only be used to draw the slider. Rect filtScreen={168,463,287,622}; Rect leftSupZone={167,386,186,460}; Rect leftInfZone={186,318,268,460}; Video Effect plug-ins intended to run on a 68k Macintosh must be compiled as Code Resources of type 'QEdF', creator '.ƒ∂!', ResType 'QEdR', ResID 128. PowerPC plug-ins must be compiled as a Code Resource of type 'QEdF', creator '.ƒ∂!', ResType 'QEdR', ResID 129 with a 'native' header. A Fat plug-in is created by pasting the QEdR resource ID 129 into the 68k plug-in with ResEdit or Resorcerer. See the 2 examples for more information...